<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>个人中心-潮聚</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link rel="stylesheet" th:href="@{/css/mui.min.css}"/>
		<link rel="stylesheet" th:href="@{/css/common.css}"/>
		<link rel="stylesheet" th:href="@{/css/icons-extra.css}"/>
	</head>
	<body>
		<div class="mui-content cj-profile-header ">
		
			<div class="cj-line-60"></div>
			<div class="cj-profile-head-info">
				
				<div class="cj-head-img mui-pull-left" ><!--头像--></div>
				
				<div class="cj-head-left mui-pull-left">
					<div class="cj-profile-name" id="userName">你的名字</div>
					<div class="cj-profile-integration">
						<span class="mui-badge mui-badge-warning" id="integral">积分:0</span>
						<span class="mui-badge mui-badge-success" id="signIn">签到</span>
					</div>
				</div>
				</div>
		</div>
		
			<div class="cj-profile-nav">
				<div class="mui-card">
					<div class="mui-card-content">
						<ul class="mui-table-view mui-grid-view mui-grid-9 cj-bg-white cj-none-border">
							<li class="mui-table-view-cell  mui-media mui-col-xs-2 mui-col-sm-2 cj-none-border cj-padded-0">
								<a href="#">
									<div class="mui-media-body cj-profile-nav-item">订单</div>
								</a>
							</li>
							<li class="mui-table-view-cell  mui-media mui-col-xs-2 mui-col-sm-2 cj-none-border cj-padded-0">
								<a href="#">
									<div class="mui-media-body cj-profile-nav-item">卡劵</div>
								</a>
							</li>
							<li class="mui-table-view-cell  mui-media mui-col-xs-2 mui-col-sm-2 cj-none-border cj-padded-0">
								<a href="#">
									<div class="mui-media-body cj-profile-nav-item">收藏</div>
								</a>
							</li>
							<li class="mui-table-view-cell  mui-media mui-col-xs-2 mui-col-sm-2 cj-none-border cj-padded-0">
								<a href="#">
									<div class="mui-media-body cj-profile-nav-item">发布</div>
								</a>
							</li>
							<li class="mui-table-view-cell  mui-media mui-col-xs-2 mui-col-sm-2 cj-none-border cj-padded-0">
								<a href="#">
									<div class="mui-media-body cj-profile-nav-item">店铺</div>
								</a>
							</li>
							<li class="mui-table-view-cell  mui-media mui-col-xs-2 mui-col-sm-2 cj-none-border cj-padded-0">
								<a href="#">
									<div class="mui-media-body cj-profile-nav-item">积分</div>
								</a>
							</li>
						</ul>
					</div>
				</div>
				
			</div>
		
		<div class="mui-content cj-profile-list">
			<div class="mui-card">
				<ul class="mui-table-view">
					<li class="mui-table-view-cell">
						<a class="mui-navigate-right" href="/user/setting">
							<span class=" cj-text-color-gray mui-icon-extra mui-icon-extra-class cj-text-size-18 cj-margin-r-10"></span>设置
						</a>
					</li>
				</ul>
			</div>
			<div class="mui-card">
				<ul class="mui-table-view">
					<li class="mui-table-view-cell">
						<a class="mui-navigate-right">
							<span class=" cj-text-color-gray mui-icon-extra mui-icon-extra-dictionary cj-text-size-18 cj-margin-r-10"></span>草稿箱
						</a>
					</li>
					<li class="mui-table-view-cell">
						<a class="mui-navigate-right">
							<span class="cj-text-color-gray mui-icon-extra mui-icon-extra-share cj-text-size-18 cj-margin-r-10"></span>分享
						</a>
					</li>
				</ul>
			</div>
			<div class="mui-card">
				<ul class="mui-table-view">
					<li class="mui-table-view-cell">
						<a class="mui-navigate-right">
						  <span class="cj-text-color-gray mui-icon-extra mui-icon-extra-peoples cj-text-size-18 cj-margin-r-10"></span>在线客服
						</a>
					</li>
				</ul>
			</div>
			<div class="mui-card">
				<ul class="mui-table-view">
					<li class="mui-table-view-cell">
						<a class="mui-text-center cj-text-color-danger"  id="loginOut">
							退出登录
						</a>
					</li>
				</ul>
			</div>
		</div>
		<div th:include="common/footer :: nav"></div>
		<script src="js/mui.min.js"></script>
   	 	<script src="js/jquery.min.js"></script>
   		 <script src="js/common.js"></script>
   		 <script>
   		 //获取用户信息
   			getUserInfo();
   			
   		//用户签到
   		$("#signIn").click(function(){
   				 $.ajax({
	   		 		url:"/user/signin",
	   		 		type:"post",
	   		 		dataType:"json",
	   		 		success:function(response){
	   		 			if(response.code==200){
	   		 				mui.toast(response.result);
	   		 				getUserInfo();
	   		 			}else{
	   		 				mui.toast(response.msg);
	   		 			}
	   		 		}
   			 });
   		});
   		 
   		 function getUserInfo(){
   		 		 $.ajax({
	   		 		url:"/user/userMessage",
	   		 		type:"post",
	   		 		dataType:"json",
	   		 		success:function(response){
	   		 			$("#userName").text(response.result.name);
						$("#integral").text("积分:"+response.result.integral);
	   		 		}
   			 });
   		 }
   		 
   		 	//退出登录
   		 		$("#loginOut").click(function(){
   		 				var btnArray = ['否', '是'];
						mui.confirm('您要退出登录，确认？', '确认', btnArray, function(e) {
							if (e.index == 1) {
									$.ajax({
			   		 					url:"/logout",
			   		 					type:"post",
			   		 					success:function(response){
			   		 								console.log("555");
													location.href = "/login";
			   		 					}
			   		 				});
							} 
						});
   		 			
   		 		});
   		 </script>
	</body>
</html>





